import { getIndexUrl } from "@apis/riskmonitorApi"
import { Spin } from "antd"
import { useEffect, useState } from "react"

const RiskMonitor = () => {

  const [loading, setLoading] = useState(true)
  const [frameUrl, setFrameUrl] = useState('')

  const getUrl = async () => {
    const {data, error} = await getIndexUrl()
    if (error) return
    setFrameUrl(data)
    setLoading(false)
  }

  useEffect(() => {
    getUrl()
  }, [])

  return (
    <div className={`page-content`} style={{padding: '0'}}>
      {loading ? <Spin spinning={loading} /> : <iframe title="RiskMonitor" frameborder='0'  src={frameUrl} width='100%' height='100%'></iframe>}
    </div>
  )
}

export default RiskMonitor